package com.cloud.gateway;

import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import reactor.core.publisher.Mono;

/**
 * @创建人 steffens
 * @创建时间 2019/6/20
 * @描述 文件创建
 */
@Configuration
public class ExampleConfiguration {
    @Bean
    @Order(-1)
    public GlobalFilter filterOne() {
        return (exchange, chain) -> {
            System.out.println("First pre filter");
            return chain.filter(exchange).then(Mono.fromRunnable(() -> {
                System.out.println("third post filter");
            }));
        };
    }
}
